﻿

alter PROCEDURE [PomSelectRentalProperty]
(
	@pPomplingAddressID INT
)
AS
BEGIN	
	SET NOCOUNT ON;
	SELECT a.[PomplingAddressID] ,rp. [PricePerCalendarMonth], [NumberOfBedrooms],WP.[ShortDescription], rp.Furnished, pi.DisplayPicturePath,
	WP.[LongDescription], a.AddressLine1, a.AddressLine2, a.City, a.County, a.Postcode, a.DateAdded
		FROM PomPomplingAddresses a
		LEFT JOIN [PomWebProperties] wp ON wp.PomplingAddressID = a.PomplingAddressID
		LEFT JOIN PomRentalProperties rp ON rp.PomplingAddressID = rp.PomplingAddressID
		LEFT JOIN [PomPropertyImages] pi ON pi.PomplingAddressID = a.PomplingAddressID AND pi.IsMainImage = 1
		WHERE a.PomplingAddressID = @pPomplingAddressID 
	order by rp.PricePerCalendarMonth ASC

END